I have a module that links to many different specs. My goal is to create script to output a csv . The script is to search for objects with links to a specific module. I then put the object text from one module into String1 the object from the linked module into String2. I want to create third sting (String3) that shows the difference between the two strings and print that to the CSV file. So far everything works except the diff(String3, String1, String2). When I run the scrip I get syntax errors. So converted the three strings into buffers and ran it. and I get an output for the difference. But when I print the String3 buffer I get so much formatting codes that I cannot interpret the output. I looked a the dxl users guide and it showed two examples with buffers not strings. Any suggestions? Should I be able to use the diff command with strings or only buffers?
.
Reality - Thu Feb 09 16:48:06 EST 2017 |
Re: creating redlines diff() My code looks similar to this: Buffer String1 create Buffer String2 create Buffer String3 create string tempString . . String1 += " ...date here from module1" String2 += " ...date here from module 2" diff(String3, String1, String2) tempString = stringOf(String3) print "\n tempstring"
|
Re: creating redlines diff() Reality - Thu Feb 09 16:55:11 EST 2017 My code looks similar to this: Buffer String1 create Buffer String2 create Buffer String3 create string tempString . . String1 += " ...date here from module1" String2 += " ...date here from module 2" diff(String3, String1, String2) tempString = stringOf(String3) print "\n tempstring"
The diff command has an option to specify the markup to use for insertions / deletions. You can use plain text markup here, like so: Buffer before = create Buffer after = create Buffer bufDiff = create before = "Some text from module 1 with data." after = " text from module 2 with data. " diff(bufDiff , before, after, "+++", "---") print bufDiff "\n" print plainText bufDiff "\n" When you look at the richtext diff you get:
{\rtf1...{+++Some} text from module {+++1}{---2} with data.{--- }}}
As you can see, the insertion of "Some" is correctly identified, as is the change of "1" -> "2" and the removal of the space at the end. When you convert the richtext to plaintext you get: +++Some text from module +++1---2 with data.--- Here you loose the information about where the insertions end. So you would need to postprocess the rtf before converting to plaintext to get something like: +++Some+++ text from module +++1+++---2--- with data.--- --- This you could read also in a log file. Regards, Mathias |
Re: creating redlines diff() Does anyone know about the diff constrains and if there is another method to solve it. I have a script that uses the diff function, comparing Object A from Object B in a baseline, but the string length is about 82K characters. Any help or any recommendations will be appreciated. The comparison result is extracted to an HTML File. |